/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View,Button,Image,TouchableOpacity,Switch} from 'react-native';
import FetchBlod from '../../utils/downImgUtils';
export default class Test extends Component {

  constructor(props){
    super(props);
    this.state = {
      imgs:[],
      printers:[],
      isCash:true
    }
  }
  componentWillMount(){
    console.log("test")
  }
  downImgs(){
    FetchBlod(["https://zafgoos.oss-cn-shanghai.aliyuncs.com/service/goods/main/Image_679546386387023332_1529553853848.jpg","https://zafgoos.oss-cn-shanghai.aliyuncs.com/service/goodsShelves/Image_6757262518283961192_1528191791532.jpg","https://zafgoos.oss-cn-shanghai.aliyuncs.com/service/goods/main/Image_4491730398584154151_1526523973335.jpg"],(path,index)=>{
      let list = this.state.imgs;
      list.push(path);
      this.setState({
        imgs:list
      })
    });
  }
  componentWillUnmount(){
    console.log(this.listner)
  }
  render() {
    let {imgs,printers,isCash} = this.state;
    return (
      <View style={styles.container}>
        <View>
          <Switch value={isCash} onValueChange = {(val)=>this.setState({isCash:val})} ></Switch>
          <Text>{isCash?"cash":"printer"}</Text>
        </View>
      </View>
    );
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
  item:{
    backgroundColor: "blue",
    margin: 10,
  },
  btn:{
    padding: 10,
    backgroundColor: "red"
  }
});
